UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'btqLueIVcvJBzl7mMeZhJwFdf3p7D/JXhFCxT2gmcCY='
WHERE
key_id = '6c22f727cf778d39e49357badb07fac79e03c98c0f87d1f1718f49d16635b448'
AND (
token = 'btqLueIVcvJBzl7mMeZhJwFdf3p7D/JXhFCxT2gmcCY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)