UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xzb8X3JScPTZOjgiMI208r4oD6AJItTfXbAPCiDvNqw=' 
WHERE 
  key_id = 'cf0dd19f61755950baa0889e36eb871a864c6def1b258927ccc00f9c6bbe8f00' 
  AND (
    token = 'xzb8X3JScPTZOjgiMI208r4oD6AJItTfXbAPCiDvNqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023