UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u40EI/oK+2l81XRuueNR12WSjo4/CsP/JrMLvBY40X0='
WHERE
key_id = '6ef9c906b094dfe16ff13b16bef1c1ce963d637ca22d422434270c4631d77303'
AND (
token = 'u40EI/oK+2l81XRuueNR12WSjo4/CsP/JrMLvBY40X0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)