UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QFg/ShYbckjTYW7GcfDdUkZZihLrKdWvGy+tHykLxEE='
WHERE
key_id = 'a843e64b872c5db21eb94f76fef135e607a5d8b8b3d804acfa3449be3b481a81'
AND (
token = 'QFg/ShYbckjTYW7GcfDdUkZZihLrKdWvGy+tHykLxEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)