UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BqCr+hnJDPs2oEQjrm01djoUoaNugitmN3oqPQS+szI='
WHERE
key_id = '34934fb0f05518f29e7d9abe4e59ca29526cc4200dfc2c17f672d997328d3367'
AND (
token = 'BqCr+hnJDPs2oEQjrm01djoUoaNugitmN3oqPQS+szI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)