UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CB8fQCDW24CTTs7cEnvmWxageX1DsOf6vg8qePtjAfE=' 
WHERE 
  key_id = '8420619c17dc424918e8ed737659ba6f0420d0d22d576e9f74a1577461343dc5' 
  AND (
    token = 'CB8fQCDW24CTTs7cEnvmWxageX1DsOf6vg8qePtjAfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017