UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ckm8OtmIjUKSosfEYzYdGKEDIVyphSV3bk1G55ALZvo='
WHERE
key_id = '005af6cc1b756ba6784590dd6fe91141263c2b0b62f8aff9166980251328abe2'
AND (
token = 'Ckm8OtmIjUKSosfEYzYdGKEDIVyphSV3bk1G55ALZvo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)