UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YKVrg6u5GZJppbGJyB/oEHODRs7rP+0RwsnNVBGotQc=' 
WHERE 
  key_id = 'e17e861fb5c7ceca0eaf015984350712dad57352434899f74c03c4a02c076335' 
  AND (
    token = 'YKVrg6u5GZJppbGJyB/oEHODRs7rP+0RwsnNVBGotQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028