UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W/y2qT8ksvz/X00F1rIwD4Q6kMLwo7N08qZpLI84klM=' 
WHERE 
  key_id = '3ca95c7856234dc11f43f141e952c9d12df18312ef9eff7b917dffc4892a12b5' 
  AND (
    token = 'W/y2qT8ksvz/X00F1rIwD4Q6kMLwo7N08qZpLI84klM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065