UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S97mdS1o8nJkaS635oIF8bRvZVgubIT9twXCjqN9/8g=' 
WHERE 
  key_id = '4d3589ac94c2a457b14ada83f8c9a7a72cceb92cfb6fd05b7ebbe279197289e4' 
  AND (
    token = 'S97mdS1o8nJkaS635oIF8bRvZVgubIT9twXCjqN9/8g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024