UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TGjM6MOSsP5/yEdIOFLBruNnRQl5JJELy+TG8DNFguw='
WHERE
key_id = '39fe23f1fdbd9ff9ffdf45fd9b361aaff5867938434996be306b600d81bfa6d1'
AND (
token = 'TGjM6MOSsP5/yEdIOFLBruNnRQl5JJELy+TG8DNFguw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)