UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7pg6JFzjGi2hkyJcUgWpgWgHMEPbYieFvg2Ix9rj7hM='
WHERE
key_id = '9986681fd51005850f6301650099842482ca80566af22850543d7079696468a4'
AND (
token = '7pg6JFzjGi2hkyJcUgWpgWgHMEPbYieFvg2Ix9rj7hM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)