UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZL104VRSeLJa/YODsenEgniNvKXQwrS+GieJ2DNSKgk=' 
WHERE 
  key_id = 'a5db031e97d3e51f0a92ac676dba4e85ba4d076bd56f26adef94999dfbd43c97' 
  AND (
    token = 'ZL104VRSeLJa/YODsenEgniNvKXQwrS+GieJ2DNSKgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043