UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ReyM7tdJoQGC941O5NK6pFDP3q0OzyUbh4nLnvsCp1Q=' 
WHERE 
  key_id = '2eaa0819519d7f6c0eff9e2b713900d8ca60b7168aa811900752cd5ca01b7160' 
  AND (
    token = 'ReyM7tdJoQGC941O5NK6pFDP3q0OzyUbh4nLnvsCp1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028