UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'etxxQbpK3OLcnueZo1yLwGFEp0APjbneoNWJAYZ6o14='
WHERE
key_id = 'f59e18ead712d496f5fe06845b077e54a2d21444ad36c59f411997cb36010f9a'
AND (
token = 'etxxQbpK3OLcnueZo1yLwGFEp0APjbneoNWJAYZ6o14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)