UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dSs74iBtDp31HrAf7Ch0qaOquTBsTA2Xnu/wWolB7xo='
WHERE
key_id = '971b82bcc0fdf838f6d5c6827bbba3020aeb00be1b306b2288927336057200e6'
AND (
token = 'dSs74iBtDp31HrAf7Ch0qaOquTBsTA2Xnu/wWolB7xo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)