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