UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5S7vKUjlQoq20+BCLz5antHSy5BiBacF1H7sJRxOn+E=' 
WHERE 
  key_id = 'bd9882d10be707308cc2c47389fcc8ac66697309eb1dc0a611b12d54bdba568c' 
  AND (
    token = '5S7vKUjlQoq20+BCLz5antHSy5BiBacF1H7sJRxOn+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037