UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '49bNQCOQFKTgnjWFJoYS6XlsBTncKovxSK6/2vVvC+o='
WHERE
key_id = '76c2096f2c02ccd2ed3a721b6fe34ed7d1f0ba209e778c5d0d3fda2a0db8159e'
AND (
token = '49bNQCOQFKTgnjWFJoYS6XlsBTncKovxSK6/2vVvC+o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)