UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't71zieQ16oMv1VIrxElUbYlaiivIEsOIt1gnBZKF8Zk='
WHERE
key_id = '766eeba29a7dd1e8b79ac0968b48a35a235f7d8af1b35eafcd561642bcb148b9'
AND (
token = 't71zieQ16oMv1VIrxElUbYlaiivIEsOIt1gnBZKF8Zk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)