UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BNcap9gibiL7BxHJiHVaY4BuEAbTs4L9QQAaJJ6kAW0='
WHERE
key_id = '2403dd50bb72c195b3a3c6ed8cb83c0d31ae85d7ace90794f39f8344b66ad029'
AND (
token = 'BNcap9gibiL7BxHJiHVaY4BuEAbTs4L9QQAaJJ6kAW0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)