UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5jVnuptqUk4vvr9ZXZXXbwI86yS90EjernSK1plUHXw='
WHERE
key_id = 'ecf5826842d49f8faf2e848a570bdec26a4ff60db86a6b3baa682164db55deb4'
AND (
token = '5jVnuptqUk4vvr9ZXZXXbwI86yS90EjernSK1plUHXw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)