UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uHtxY+qLPXMWnfx3OZ+Z9T3cStghzgvOMIzik7V0Mwc='
WHERE
key_id = 'c76d9381f1dd3040eee39e6a672ab628e620161c04613338bea35abcde9ba83e'
AND (
token = 'uHtxY+qLPXMWnfx3OZ+Z9T3cStghzgvOMIzik7V0Mwc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)