UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ptfQiq/sVxdf1h18Fr/e9w6uukQXYeHfX82mWrPdLGE='
WHERE
key_id = 'e3c917b8367534dc4cbe4e06de3e3f1ba467f01f76561c215948c753bb6b9d0e'
AND (
token = 'ptfQiq/sVxdf1h18Fr/e9w6uukQXYeHfX82mWrPdLGE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)