UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z9w5bM667C4r2p2RYZNiSIQ3dUzVtBrPJ67tXTMI/UA='
WHERE
key_id = '9ec99bb923e0864637a56d6687c942c3e1462b6af164804643efca262e84c96a'
AND (
token = 'z9w5bM667C4r2p2RYZNiSIQ3dUzVtBrPJ67tXTMI/UA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)