UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ULncJ5xiJ+jI8IGt/LWwyuJe26OHpSd+WBLHjpQaFk0='
WHERE
key_id = 'a4d471e4101852b12fb851334f7f56bfc3da887e44122d5ec470727cb95ce64f'
AND (
token = 'ULncJ5xiJ+jI8IGt/LWwyuJe26OHpSd+WBLHjpQaFk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)