UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+6alcXMaACeS6IBZ2623LCUay/tTgP1nc4sqqV7i2M=' 
WHERE 
  key_id = 'f0ec9e4cfa260f360f05e9588664fac06153deba3af98cba03215a2e8dc41b0b' 
  AND (
    token = 'P+6alcXMaACeS6IBZ2623LCUay/tTgP1nc4sqqV7i2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029