UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qOM7TverDuz2Xoty1Suuc/Ap4EDDRKzrYOwUtUdwqFc='
WHERE
key_id = '33f5825512bc85c77eb3881cac3e46b2336e8941e7d21d24121001555a308af0'
AND (
token = 'qOM7TverDuz2Xoty1Suuc/Ap4EDDRKzrYOwUtUdwqFc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)