UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iGvZHCE/Z8E25lYcCv1p/g0THfyIKs73RgGL5PXEv3k='
WHERE
key_id = 'd321251e5529dd189a327934487c59f89424fae01a4ff729614f37ff83109b3a'
AND (
token = 'iGvZHCE/Z8E25lYcCv1p/g0THfyIKs73RgGL5PXEv3k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)