UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BRR8fgBmizX47c9wEpoG763gy8PISRvyfEYiL4i9Ez0='
WHERE
key_id = '6d83a4093196b9c81f4830c31e68c7037fd52a2beb3d3d6e9a1751d706ee8caf'
AND (
token = 'BRR8fgBmizX47c9wEpoG763gy8PISRvyfEYiL4i9Ez0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)