UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'snwYDrcwI/OZbfBs0SyEvfOT2MXg4MJ5QXmENfd9pFE=' 
WHERE 
  key_id = 'f83e3937d6c961d013389ec2d4a94d4725125789fd688deabdffb9e3b2e40ee2' 
  AND (
    token = 'snwYDrcwI/OZbfBs0SyEvfOT2MXg4MJ5QXmENfd9pFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030