UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Urhxng0slzh0lKWBIgDjm4u8d8U2mNv0v0ePWxloIZA=' 
WHERE 
  key_id = '9a2ded0119384254049c69f80ee9d13cbb5afe067245639065427f48dd139ad0' 
  AND (
    token = 'Urhxng0slzh0lKWBIgDjm4u8d8U2mNv0v0ePWxloIZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032