UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7sKDZfK2C+nLmUNaWAenuVN+M6OMxFpCnqz+PhDRYW8='
WHERE
key_id = 'd757405e748ae94a36ba8ae7ca4412a1400e80cc3dd7a07ef244b5eb3445df3d'
AND (
token = '7sKDZfK2C+nLmUNaWAenuVN+M6OMxFpCnqz+PhDRYW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)