UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NPxh0etOyJ8aTgBaTepVENcwNZsU5pMuOKhkr9EQL5E='
WHERE
key_id = '83a1b7405d4536966ce4ce6e886b3cba1f723bb86b8b4b731ec23064c3186cb6'
AND (
token = 'NPxh0etOyJ8aTgBaTepVENcwNZsU5pMuOKhkr9EQL5E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)