UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UaNQZm7cDenoJwlIqCofZyoBiG/uVwbWnO6KOMu5Tps='
WHERE
key_id = '47d8f36d73e5c51f2cb187ce0104bce0f1513cc9379da37173df2c0e3e7b2aed'
AND (
token = 'UaNQZm7cDenoJwlIqCofZyoBiG/uVwbWnO6KOMu5Tps='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)