UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sHYAuNcO96rFwjitqv0S6QOIy/toIpKEAlHcFTARAko=' 
WHERE 
  key_id = 'da31ebf61dce10f66ac5af9b47596751927ffa6a10d90231852500b5f3be71e2' 
  AND (
    token = 'sHYAuNcO96rFwjitqv0S6QOIy/toIpKEAlHcFTARAko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037