UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3gUrj4rQJFif+TEeowd8Z0b7lMGeUXNbaPYwZe4fkGY='
WHERE
key_id = '37e6ff8f11e842091e3f7acd8e17eee67a655a182c3d566114a6e2ad7a89bb95'
AND (
token = '3gUrj4rQJFif+TEeowd8Z0b7lMGeUXNbaPYwZe4fkGY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)