UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rl9Lj38ZUk60Su4FwBzeeswTM4MC/cVN3Z2eXXmKsVw=' 
WHERE 
  key_id = '875545175ab8bb4fc0b57333247a0e31b71fcea56e692bead1294d475980600e' 
  AND (
    token = 'rl9Lj38ZUk60Su4FwBzeeswTM4MC/cVN3Z2eXXmKsVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049