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