UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6g0YUiqq7OuQGgvOoLaCrOuHeORlcuPz9BfwFjStcOY=' 
WHERE 
  key_id = 'cde46a6e86d4c75e53e7b9affb2af867cb0e611fa387ec2935400595b95d78f8' 
  AND (
    token = '6g0YUiqq7OuQGgvOoLaCrOuHeORlcuPz9BfwFjStcOY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025