UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ybgm1zXeKzFgiFmmT/gA3iCky7f5gzsRpQMyGHWm6Mc='
WHERE
key_id = 'bf6683f9d30d35593d15b7fd2a7bb367cf2e8c427e83c829f562d1abb5efd65c'
AND (
token = 'Ybgm1zXeKzFgiFmmT/gA3iCky7f5gzsRpQMyGHWm6Mc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)