UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eJNpVLSOjsfyUpX3tifKhD/chuLyVcRD/XFdL7s9sXk='
WHERE
key_id = 'bf51ce4f6f0ca2072d5cffc924d575e18435e4f8654a15ffe286f8cdf8da642a'
AND (
token = 'eJNpVLSOjsfyUpX3tifKhD/chuLyVcRD/XFdL7s9sXk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)