UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tTiWrFXYzfy0ECS8Bog6JyxmbjJtwryp4a2v3VWn/Xk='
WHERE
key_id = 'dd2376b0b1ebcf05ac978af9bb38ff5bb7dbb892fa4213945b2150a8145f9d0c'
AND (
token = 'tTiWrFXYzfy0ECS8Bog6JyxmbjJtwryp4a2v3VWn/Xk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)