UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KKF3ciulAaLniplG68U4tdKiCgwp/kTSNg596WDsbaM='
WHERE
key_id = 'aeb510df84e7c8d2f231d19594aec466d05c10b52a59cc7741f0519f144f10d8'
AND (
token = 'KKF3ciulAaLniplG68U4tdKiCgwp/kTSNg596WDsbaM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)