UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jBkeDVjpt3dMvdK/fwtmIAYMkRhHav+hLZGx1qEFX88='
WHERE
key_id = 'e896dc0f9fda04f6c2f42175224d39dbbcb741c7adabbb69b2df8e149eb1e2db'
AND (
token = 'jBkeDVjpt3dMvdK/fwtmIAYMkRhHav+hLZGx1qEFX88='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)