UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jwvg/4cdf6UEwmjyPFRa9oexCHRexND2WFbq+u6BXBs=' 
WHERE 
  key_id = '318821a0bbb5b9e235954a4fec7cc6a1fbf6fc0fd6f9e17497230747e46d03ee' 
  AND (
    token = 'jwvg/4cdf6UEwmjyPFRa9oexCHRexND2WFbq+u6BXBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022