UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p54HFljM52kvddWciFGLGqVbllw8aXpNCFxjvGBRAYc='
WHERE
key_id = '7a044a1f03ed95c67ff1adabb7a4dc7bc102720a49ed8720dac622cfffaf9c27'
AND (
token = 'p54HFljM52kvddWciFGLGqVbllw8aXpNCFxjvGBRAYc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)