UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7Kcv2nCsFJSJQd1sG5s0I9AyMqofxA1EllnWMRbmATU='
WHERE
key_id = '65a3bf721f256bda0fa7a736f03efd45d311da5cad09f83e192b348c11cab3a3'
AND (
token = '7Kcv2nCsFJSJQd1sG5s0I9AyMqofxA1EllnWMRbmATU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)