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