UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A+2LovNkSytVVyX+3TZos3Yn2HUbzi8Uv66so5HXUx0=' 
WHERE 
  key_id = '901e8d5b80fa0385991b915d07526715e9721e825674f7d5d4da021e8f84a597' 
  AND (
    token = 'A+2LovNkSytVVyX+3TZos3Yn2HUbzi8Uv66so5HXUx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040