UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XzHisDdoGatsua4RJx0kmYzYFXtKPFyq7WshRr8H3vM=' 
WHERE 
  key_id = '0624efad15480fc2467cb362c18c75272b048cace841930ba954a89919166a74' 
  AND (
    token = 'XzHisDdoGatsua4RJx0kmYzYFXtKPFyq7WshRr8H3vM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043