UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yeyo9J5dJRuZInHCpBwB7p+IN/N1a1Qg4JfG6k/MJXA='
WHERE
key_id = 'd8841a1ee22b0c1b85829057df382f117803fa5a53427312a484da8ccaf55244'
AND (
token = 'Yeyo9J5dJRuZInHCpBwB7p+IN/N1a1Qg4JfG6k/MJXA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)