UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EyT3LJ+38V4sWqfWSlRoq3BWqUOoP8IVGHRPVukrY9U=' 
WHERE 
  key_id = '9dceb43ba9cc84e8c50de0080dacf4fb48ec6e0243ff8524c661636f62e62c32' 
  AND (
    token = 'EyT3LJ+38V4sWqfWSlRoq3BWqUOoP8IVGHRPVukrY9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025